<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>

    var str = new String("abcd");

   console.log(str);
   for(var i=0;i<str.length;i++){
       console.log(str.charAt(i));
   }
   console.log(str.charAt(0));
   console.log(str.charAt(1));
   console.log(str.charAt(2));
   console.log(str.charAt(3));

    //返回unicode中的码表值。
    console.log(str.charCodeAt(2));





</script>
</body>
</html>